home *** CD-ROM | disk | FTP | other *** search
- Path: news.crystalball.com!news
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.lang.c
- Subject: Re: #include "" for large programs.
- Date: Tue, 16 Apr 1996 15:10:34 -0500
- Organization: ...
- Message-ID: <3173FEBA.15E6@oc.com>
- References: <Pine.SUN.3.92.960411195730.24973A-100000@suntan> <4kmbnr$89@newshost.cyberramp.net>
- NNTP-Posting-Host: external.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (Win95; I)
- CC: lfw@oc.com
-
- John L. Noland wrote:
- >
- > #include "part2.h"
- > this tells it to look in the current working directory.
- >
-
- Actually, all the search semantics of the #include directive are implementation
- defined for both <> and "" formats. So any interpretation is highly
- dependant on the documentation supplied with the implementation and the
- standard does not distinguish between the two forms except to say that
- if the two are defined to be different and the "" form is used, then if
- the "" form fails to resolve, then the <> rules are tried.
-
- I avoid the "" form if at all possible because the "current working directory"
- type rules that you mention can get you into trouble in some common
- implementations when you employ nested #includes. The problem is that the
- "current working directory" is defined with respect to the directory containing
- the file that contains the #include directive (which may be an included file
- itself and not one resident in the same directory containing the original
- source file) and this can result in different files being used to resolve the
- same named header file in different modules of the same program. Again, this
- is a description of implementation defined semantics, and is not necessarily the
- only implementation. But most UNIX and PC compilers define it this harzardous
- way.
-